package com.cqupt.scanning.system.admin.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cqupt.scanning.system.admin.entity.PatientFoot;
import com.cqupt.scanning.system.admin.service.PatientFootService;
import com.cqupt.scanning.system.utils.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 宋宝梁
 * @since 2021-07-06
 */
@RestController
@RequestMapping("/admin/organization/patientfoot")
public class PatientFootController {

    private PatientFootService patientFootService;

    @Autowired
    public PatientFootController(PatientFootService patientFootService) {
        this.patientFootService = patientFootService;
    }

    /**
     * 获取所有病人（支持模糊查询）
     */
    @GetMapping("/getAll")
//    @PreAuthorize("hasAuthority('plantarScanning.queryAll')")
    public R getAll(@RequestParam(value = "name",required = false) String name,
                      @RequestParam(value = "age_lower",required = false) String ageLower,
                      @RequestParam(value = "age_upper",required = false) String ageUpper,
                      @RequestParam(value = "doctor",required = false) String doctor,
                      @RequestParam(value = "height_lower",required = false) String heightLower,
                      @RequestParam(value = "height_upper",required = false) String heightUpper,
                      @RequestParam(value = "measureMode",required = false) String measureMode,
                      @RequestParam(value = "sex",required = false) String sex,
                      @RequestParam(value = "weight_lower",required = false) String weightLower,
                      @RequestParam(value = "weight_upper",required = false) String weightUpper,
                      @RequestParam(value = "orgName",required = false) String orgName,
                      @RequestParam(value = "devNum",required = false) String devNum,
                      @RequestParam(value = "beginTime",required = false) String beginTime,
                      @RequestParam(value = "endTime",required = false) String endTime,
                      @RequestParam(value = "username",required = false) String userName,
                      @RequestParam(value = "phone",required = false) String phone,
                      @RequestParam(value = "pageNum", defaultValue = "1") Integer current,
                      @RequestParam(value = "pageSize", defaultValue = "10") Integer size) {
        System.out.println("当前是第"+current+"页,单页可展示"+size+"条");
        Page<PatientFoot> page = new Page<>(current, size);
        return patientFootService.getAll(page, name, ageLower, ageUpper, doctor, heightLower, heightUpper, measureMode, sex, weightLower, weightUpper, beginTime, endTime,userName,phone,orgName,devNum);
    }


}

